package ui.panel.warriors {
	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	
	import globals.Global;
	
	import ui.component.Label;
	import ui.component.TextButton;
	import ui.face.Bar;
	
	import util.UIUtil;
	
	public class WarriorInfo extends Sprite {
		
		private var nameLabel:Label;
		private var warriorView:Bitmap;
		private var jobLabel:Label;
		private var levelLabel:Label;
		private var expBar:Bar;
		private var equipButton:TextButton;
		private var presenceButton:TextButton;
		private var trainButton:TextButton;
		private var transferButton:TextButton;
		
		public function WarriorInfo() {
			super();
			initUI();
			update();
		}
		
		private function initUI():void {
			var bg:Bitmap = new Bitmap(Global.assetsManager.getAssetsAsBitmapData("warrior_bg", "ui"));
			addChild(bg);
			
			nameLabel = new Label(12, 0xFFFFFF, true);
			nameLabel.x = 50;
			nameLabel.y = 20
			addChild(nameLabel);
			
			warriorView = new Bitmap();
			addChild(warriorView);
			
			jobLabel = new Label(12, 0xFFFFFF, true);
			jobLabel.x = 20;
			jobLabel.y = 140;
			addChild(jobLabel);
			
			levelLabel = new Label(12, 0xFFFFFF, true);
			levelLabel.x = 80;
			levelLabel.y = 140;
			addChild(levelLabel);
			
			expBar = new Bar("warrior_exp_track", "warrior_exp_bar_bg");
			expBar.x = 20;
			expBar.y = 162;
			addChild(expBar);
			
			equipButton = UIUtil.getTextButton("装备", ["button_blue_off", "button_blue_on", "button_blue_off"], equipHandler);
			equipButton.x = 48;
			equipButton.y = 185;
			addChild(equipButton);
			
			presenceButton = UIUtil.getTextButton("派驻", ["button_blue_off", "button_blue_on", "button_blue_off"], presenceHandler);
			presenceButton.x = 48;
			presenceButton.y = 220;
			addChild(presenceButton);
			
			trainButton = UIUtil.getTextButton("训练", ["button_blue_off", "button_blue_on", "button_blue_off"], trainHandler);
			trainButton.x = 48;
			trainButton.y = 255;
			addChild(trainButton);
			
			transferButton = UIUtil.getTextButton("转职", ["button_blue_off", "button_blue_on", "button_blue_off"], transferHandler);
			transferButton.x = 48;
			transferButton.y = 290;
			addChild(transferButton);
		}
		
		private function equipHandler(button:TextButton):void {
			
		}
		
		private function presenceHandler(button:TextButton):void {
			
		}
		
		private function trainHandler(button:TextButton):void {
			
		}
		
		private function transferHandler(button:TextButton):void {
			
		}
		
		public function update():void {
			nameLabel.text = "弓箭手";
			warriorView.bitmapData = Global.assetsManager.getAssetsAsBitmapData("warrior", "ui");
			warriorView.y = 50;
			warriorView.x = warriorView.width / 2;
			jobLabel.text = "弓箭手";
			levelLabel.text = "等級：" + 1;
			expBar.update(100, 150);
		}
		
		public function clear():void {
			
		}
	}
}